package lu.med.praxiswahl.wahlumed.client.mahnungen;

import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.TableColumn;

import lu.med.praxiswahl.wahlumed.client.utilities.ColumnWidthControler;
import lu.med.praxiswahl.wahlumed.client.wclient.Main;


public class MahnungenTable extends JTable
{

    /**
     * 
     */
    private static final long serialVersionUID = 1779126048520486079L;

    public MahnungenTable(MahnungenTableModel model)
    {
	super(model);
	// TableRowSorter<LieferantenTableModel> rowSorter = new
	// TableRowSorter<LieferantenTableModel>();
	// this.setRowSorter(rowSorter);
	// rowSorter.setModel(model);
	// LieferantenTableStringConverter strComp = new
	// LieferantenTableStringConverter();
	// rowSorter.setStringConverter(strComp);
	this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	this.selectionModel = getSelectionModel();
	this.selectionModel
		.addListSelectionListener(new MahnungenTableSelectionListener(
			model));

	TableColumn column = null;

	ColumnWidthControler c = new ColumnWidthControler(
		Main.COLUMNWIDTH_CONFIGURATION_FILE, "mahnungtbl", this);

	for (int i = 0; i < 10; i++)
	{
	    column = this.getColumnModel().getColumn(i);
	    column.setPreferredWidth(c.getColumnWidth(i));
	}
    }
}